<?php
declare(strict_types=1);
namespace App\Controller\Cash\v1;

use App\Controller\AbstractController;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Middleware;
use App\Middleware\CashMiddleware;
use Service\StoreCardService\StoreCardService;

/**
 * 储值卡
 * @author Luoshumai
 * @Controller(prefix="/cash/v1/storecard")
 * @Middleware(CashMiddleware::class)
 */
class StoreCardController extends AbstractController
{
    /**
     * @Inject
     * @var StoreCardService
     */
    protected $cardService;

    /**
     * 查询储值卡接口
     * @RequestMapping(path="selectstoredcard", methods="post")
     */
    public function selectStoredCard(RequestInterface $request)
    {
        return $this->cardService->selectStoredCard($request->getAttribute('cid'),$request->getAttribute('mn_sid'),$request->getParsedBody());
    }

    /**
     * 验证储值卡支付密码接口
     * @RequestMapping(path="checkStoredCard", methods="post")
     */
    public function checkStoredCard(RequestInterface $request)
    {
        return $this->cardService->checkStoredCardPayPassWord($request->getAttribute('cid'),$request->getAttribute('mn_sid'),$request->getParsedBody());
    }
}